package com.woniu.postbar.controller;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.woniu.common.config.PostQueueConfig;
import com.woniu.common.constant.PostBarConstant;
import com.woniu.common.entity.Result;
import com.woniu.postbar.entity.dto.PostAdminDTO;
import com.woniu.postbar.pojo.PostAdmin;
import com.woniu.postbar.service.IPostAdminService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.web.bind.annotation.*;

import java.sql.Wrapper;
import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author wu
 * @since 2023-05-20
 */
@RestController
@RequestMapping("/postAdmin")
@Api(tags = "物业公告管理")
public class PostAdminController {

    @Autowired
    private IPostAdminService postAdminService;

    @GetMapping("/listAnnouncement")
    @ApiOperation("查询物业公告信息")
    public Result listPropertyAnnouncement() {
        List<PostAdmin> postAdmins = postAdminService.list();
        return Result.ok(postAdmins);
    }

    @PostMapping("/addAdminPost")
    @ApiOperation("添加物业公告")
    public Result addAdminPost(@RequestBody PostAdminDTO postAdmin){
         postAdminService.addAdminPost(postAdmin);
        return Result.ok();
    }
}
